{extend name='admin@public/content'}
{block name="content"}
<!-- 表单搜索 开始 -->
<script>
    window.laydate.render({range: true, elem: '#range-date'});
</script>
<!-- 表单搜索 结束 -->

<form onsubmit="return false;" data-auto="true" method="post">
    <p class="help-block text-center well">{$list['shopname']}</p>
    <!--{empty name='list.list'}-->
    <p class="help-block text-center well">没 有 记 录 哦！</p>
    <!--{else}-->
    <input type="hidden" value="resort" name="action">
    <table class="layui-table" lay-skin="line">
        <thead>
        <tr>
            <th class='text-left nowrap'>项目名称 </th>
            <th class='text-left nowrap'>类别</th>
            <th class='text-left nowrap'>已售</th>
            <th class='text-left nowrap'>注册时间</th>
            <th class='text-left nowrap'>状态</th>
            <th class='text-left nowrap'></th>
        </tr>
        </thead>
        <tbody>
        {foreach($list['list'] as $key=>$value)}
        <tr>
            <td class='text-left nowrap'>
                {$value.name|default='暂无'}
            </td>
            <td class='text-left nowrap'>
                {$value.ctype|default='暂无'}
            </td>
            <td class='text-left nowrap'>
                {$value.soldnum|default='暂无'}
            </td>
            <td class='text-left nowrap'>
                {$value.created_at|default='暂无'}
            </td>
            <td class='text-left nowrap'>
                <?php if($value['status'] ==1 ){?>
                <a class="typeedit menu-item-deleted layui-btn layui-btn-sm  layui-btn-normal" data-id="{$value.id}" >正常</a>
                <?php }else{?>
                <a class=" typeedit menu-item-deleted layui-btn layui-btn-sm layui-btn-danger " data-id="{$value.id}">锁定</a>
                <?php }?>
            </td>
            <td class='text-left nowrap'>
                <a class="layui-btn layui-btn-xs" data-open='{:url("$classuri/serviceEdit")}?id={$value.id}'>编辑</a>
            </td>
        </tr>
        {/foreach}
        </tbody>
    </table>
    {if isset($list.page)}<p>{$list.page|raw}</p>{/if}
    <!--{/empty}-->
</form>
{/block}
{block name="script"}
<!--表单初始化-->
<script>
    window.laydate.render({range: true, elem: '#create_at'});
    window.form.render();

    $('.typeedit').on('click',function () {
        var id = $(this).data('id');
        var dialogIndex = $.msg.confirm('请谨慎操作？', function (){
            $.msg.close(dialogIndex);
            $.ajax({
                url:'admin/adminshop/edittype',
                type:'GET',
                data:{id:id,type:2},
                success:function(data){
                    console.log(data);
                    window.location.reload()
                }
            })
        });
    });
</script>
<!--引入标签设置-->
{/block}